package com.boyi.center.controller.impl;


import com.alibaba.dubbo.config.annotation.Reference;
import com.boyi.center.controller.UserController;
import com.boyi.center.service.BaseService;
import com.boyi.center.service.UserService;
import com.boyi.db.entity.User;
import com.boyi.shared.common.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author 颜培轩
 * @date 2017年12月29日  0:04
 */
@RestController
@RequestMapping("user")
@Api(value = "用户信息管理模块接口->api", tags = {"API获取用户信息Controller"})
public class UserControllerImpl implements UserController {

    @Reference(check = true)
    private UserService baseService;

    @PostMapping
    @Override
    public Result<List<User>> save(User entity) {
        return baseService.save(entity);
    }

    @DeleteMapping
    @Override
    public Result<List<User>> delete(User entity) {
        return baseService.deleteByPrimaryKey(entity);
    }

    @PutMapping
    @Override
    public Result<List<User>> updateNotNull(User entity) {
        return baseService.updateByPrimaryKeySelective(entity);
    }

    @GetMapping
    @Override
    public Result<List<User>> select(User entity) {
        return baseService.select(entity);
    }

    @PostMapping("test")
    public String test(User entity, String name) {
        return "success";
    }
}
